<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>新建转正</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-first">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>人员</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="arcid" class="layui-input arcid" onclick="openPage('../public/choose_archive.php?dom=arcid&page=archive_zhuan','80%','80%')">
                            <div class="choose_div" id="arcid" key="1"></div>
                            <span class="choose_one" onclick="openPage('../public/choose_archive.php?dom=arcid&page=archive_zhuan','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>入职日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="intodt" id="intodt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">所属部门</label>
                        <div class="layui-input-block">
                            <input type="text" id="deptname" placeholder="请输入" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">岗位</label>
                        <div class="layui-input-block">
                            <input type="text" id="gangname" placeholder="请输入" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>试用期到期日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="shidaodt" id="shidaodt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>试用期工资(元/月)</label>
                        <div class="layui-input-block">
                            <input type="text" name="gongfee" id="gongfee" placeholder="请输入" clearable autocomplete="off" class="layui-input moneyinput">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>申请转正日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="zhuandt" id="zhuandt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>转正工资(元/月)</label>
                        <div class="layui-input-block">
                            <input type="text" name="zhuanfee" id="zhuanfee" placeholder="请输入" clearable autocomplete="off" class="layui-input moneyinput">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item height_auto">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label label_textarea">备注</label>
                        <div class="layui-input-block">
                            <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="block-generic">
            <div class="layui-form-item height_auto">
                <div id="upload_files">
                    <?php include '../public/upinfo.php'?>
                </div>
            </div>
        </div>
    </div>
</form>
<script>
    $("#commentForm").validate({
        rules: {
            dt: {required: true},
            intodt: {required: true},
            shidaodt: {required: true},
            gongfee: {required: true},
            zhuandt: {required: true},
            zhuanfee: {required: true},
        },
        messages:{
            dt: {required: "请选择"},
            intodt: {required: "请选择"},
            shidaodt: {required: "请选择"},
            gongfee: {required: "请输入"},
            zhuandt: {required: "请选择"},
            zhuanfee: {required: "请输入"},
        }
    });

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_archive_zhuan_add}).done(function(res){
            if (res.code === 2000) {
                var data = res.data;

                public_upload_file_load('upload_files');
                initParseMoney();
                render_from();
            }
        });



        form.on('submit(add)', function(data){
            parseMoney(data);
            var validRes = $("#commentForm").valid();


            data.field.arcid = get_choose_val('arcid');
            formValid('arcid');
            if(data.field.arcid == undefined || !data.field.arcid){
                validRes = false;
            }
            if(!validRes){return false;}

            data.field.files = public_upload_file_value('upload_files');
            facade.ajax({url: ask_archive_zhuan_add, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });

</script>
</body>
</html>
